package xin.marcher.module.common.enums.quality;

import java.util.HashMap;
import java.util.Map;

/**
 * 资质证明上传状态枚举: 0-未上传,1-已上传,2-等待继续上传
 */
public enum QualityUploadStatusEnum {
    /**
     * 0-未上传
     */
    NOT_UPLOADED(0, "未上传"),

    /**
     * 1-已上传
     */
    UPLOADED(1, "已上传"),

    /**
     * 2-等待继续上传
     */
    REPLENISH_UPLOADED(2, "等待继续上传");

    private Integer code;

    private String value;

    QualityUploadStatusEnum(Integer code, String value) {
        this.code = code;
        this.value = value;
    }

    public Integer getCode() {
        return code;
    }

    public String getValue() {
        return value;
    }

    public static Map<Integer, String> toMap() {
        Map<Integer, String> map = new HashMap<>(16);
        for (QualityUploadStatusEnum element : QualityUploadStatusEnum.values()) {
            map.put(element.getCode(), element.getValue());
        }
        return map;
    }

    public static QualityUploadStatusEnum getByCode(Integer code) {
        if (code == null) {
            return null;
        }
        for (QualityUploadStatusEnum element : QualityUploadStatusEnum.values()) {
            if (code.equals(element.getCode())) {
                return element;
            }
        }
        return null;
    }
}
